﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MediaLibrary
{
    /// <summary>
    /// Interaction logic for SettingsPage.xaml
    /// </summary>
    public partial class SettingsPage : Page
    {
        // 
        private Uri watchFolderPage = new Uri("../Controls/WatchFolderPage.xaml", UriKind.Relative);

        // 
        private Uri playlistOptionsPage = new Uri("../Controls/PlaylistOptionsPage.xaml", UriKind.Relative);

        // 
        private Uri exclusionListPage = new Uri("../Controls/ExclusionListPage.xaml", UriKind.Relative);

        // 
        private Uri fileAssociationPage = new Uri("../Controls/FileAssociationsPage.xaml", UriKind.Relative);

        /// <summary>
        /// 
        /// </summary>
        public SettingsPage()
        {
            InitializeComponent();

            SetPage(Pages.WatchFolderSettings);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void watchFolderButton_Click(object sender, RoutedEventArgs e)
        {
            SetPage(Pages.WatchFolderSettings);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void playlistOptionsButton_Click(object sender, RoutedEventArgs e)
        {
            SetPage(Pages.PlayistOptionsSettings);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void exclusionListButton_Click(object sender, RoutedEventArgs e)
        {
            SetPage(Pages.ExclusionList);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void fileAssociationButton_Click(object sender, RoutedEventArgs e)
        {
            SetPage(Pages.FileAssociationPage);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pages"></param>
        private void SetPage(Pages pages)
        {
            this.watchFolderButton.IsChecked = false;
            this.playlistOptionsButton.IsChecked = false;
            this.exclusionListButton.IsChecked = false;
            this.fileAssociationButton.IsChecked = false;

            switch (pages)
            {
                case Pages.WatchFolderSettings:
                    this.watchFolderButton.IsChecked = true;
                    this.settingsFrame.Source = watchFolderPage;
                    break;

                case Pages.PlayistOptionsSettings:
                    this.playlistOptionsButton.IsChecked = true;
                    this.settingsFrame.Source = playlistOptionsPage;
                    break;

                case Pages.ExclusionList:
                    this.exclusionListButton.IsChecked = true;
                    this.settingsFrame.Source = exclusionListPage;
                    break;

                case Pages.FileAssociationPage:
                    this.fileAssociationButton.IsChecked = true;
                    this.settingsFrame.Source = fileAssociationPage;
                    break;

            }
        }
    }
}
